package com.ftl.saludos;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class SaludosDBHelper extends SQLiteOpenHelper{
	

	private static final String DATABASE_NAME = "saludos";
    private static final int DATABASE_VERSION = 2;
    public static final String TABLA_EVENTOS = "eventos";
    
    
    private static final String CREAR_TABLA_EVENTOS =
                "CREATE TABLE IF NOT EXISTS " + TABLA_EVENTOS +  "(" +
                EventosDBAdapter.KEY_ID + " INTEGER PRIMARY KEY autoincrement, " +
                EventosDBAdapter.KEY_ID_TIPO_EVENTO + " INT, " +
                EventosDBAdapter.KEY_NOMBRE_RECEPTOR + " VARCHAR(100), " +
                EventosDBAdapter.KEY_EMAIL_RECEPTOR + " VARCHAR(100), " +
                EventosDBAdapter.KEY_FECHA + " DATE, " +
                EventosDBAdapter.KEY_COMENTARIO + " TEXT, " +
                EventosDBAdapter.KEY_MARCO + " INTEGER , " +
                EventosDBAdapter.KEY_RUTA_FOTO + " VARCHAR(250) , " +
                EventosDBAdapter.KEY_ESTADO + " INTEGER , " +
                EventosDBAdapter.KEY_FECHA_ALTA + " DATETIME );";
	

    SaludosDBHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREAR_TABLA_EVENTOS);
    }

	public void onUpgrade(SQLiteDatabase database, int oldVersion,
			int newVersion) {
		Log.w(SaludosDBHelper.class.getName(),
				"Upgrading database from version " + oldVersion + " to "
						+ newVersion + ", which will destroy all old data");
		database.execSQL("DROP TABLE IF EXISTS eventos");
		onCreate(database);
	}
	
	
}

